package com.zmn.oms.zmn.business.interfaces.part;

import com.zmn.oms.common.dto.OmsOperator;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.dto.fcorderpart.ApplyFactoryPartCheckDTO;
import com.zmn.oms.model.dto.fcorderpart.FcOrderPartRespDTO;
import com.zmn.oms.model.dto.fcorderpart.OrderFactoryPartDTO;
import com.zmn.oms.model.dto.fcorderpart.expressage.ExpressageDTO;
import com.zmn.oms.model.dto.order.zmn.FactoryNewOrderPartDIO;
import com.zmn.oms.model.dto.part.FactoryPartDTO;
import com.zmn.oms.model.dto.part.FactoryPartPostDTO;
import com.zmn.oms.model.dto.part.OrderPartPostListDTO;
import com.zmn.oms.model.entity.fcorderpart.*;
import com.zmn.oms.model.entity.fcorderpart.detail.FcOrderPartDetail;

import java.util.List;

/**
 * 类描述：工单厂家配件业务接口
 *
 * @author LiangHailong
 * @date 2019/05/15 15:54
 */
public interface ZsOrderFactoryPartBService {

    ApplyFactoryPartCheckDTO applyFcPartCheck(Long orderId) throws OmsBaseException;

    /**
     * 申请厂家配件
     * @param orderFactoryPartDTO
     */
    void applyFcPart(OrderFactoryPartDTO orderFactoryPartDTO) throws OmsBaseException;

    /**
     * 查询厂商配件详情
     * @param fcOrderPartId
     */
    FcOrderPartDetail detail(Integer fcOrderPartId) throws OmsBaseException;

    /**
     * 旧件返厂信息
     * @param fcOrderOldPartReturn
     */
    void saveOldPartReturn(FcOrderOldPartReturn fcOrderOldPartReturn);

    /**
     * 插入邮寄配件信息
     * @param fcOrderPartPost
     */
    void savePartPost(FcOrderPartPost fcOrderPartPost);

    /**
     * 配件撤回
     * @param fcOrderPartId
     */
    void recall(Integer fcOrderPartId,Long orderId);

    /**
     * 获取物流配件
     * @param orderId
     * @return
     */
    FcOrderPartRespDTO getExpressParts(Long orderId) throws OmsBaseException;

    /**
     * 工程师获取需要返厂的配件
     * @param omsOperator
     * @return
     * @throws Exception
     */
    List<FactoryPartDTO> getToPostReturnFcPart(OmsOperator omsOperator);

    /**
     * 邮寄配件（旧件返厂）
     * @param factoryPartPostDTO
     */
    void updatePostReturnFcPart(FactoryPartPostDTO factoryPartPostDTO) throws OmsBaseException;

    /**
     * 获取需要旧件返厂但尚未邮寄的配件邮寄基础信息
     * @param orderId
     * @return
     */
    List<OrderFactoryPartPost> getToPostReturnFcPartPost(Long orderId);

    /**
     * 获取待审核状态的厂商配件
     * @param orderId
     * @return
     */
    List<OrderFactoryPart> getWaiting4ReviewPart(Long orderId);
    /**
     * 获取审核成功状态的厂商配件
     * @param orderId
     * @return
     */
    List<OrderFactoryPart> getReviewSuccessPart(Long orderId);

    /**
     * 判断是否含有待审核状态的厂商配件，有返回true
     * @param orderId
     * @return
     */
    boolean containsWaiting4ReviewPart(Long orderId);

    /**
     * 判断是否含有需要旧件返厂但尚未邮寄的邮寄的配件，有返回true
     * @param orderId
     * @return
     */
    boolean containsToPostReturnFcPart(Long orderId);

    /**
     * 通过工单厂商配件ID查物流信息，用于工程师端修改配件邮寄信息前的信息查询
     * @param fcOrderPartId
     * @return
     */
    FactoryPartDTO getExpressPartById(Integer fcOrderPartId) throws OmsBaseException ;

    /**
     *  查询订单 待审核的配件
     * @param orderId
     * @return
     */
    List<OrderFactoryPart> findParts4Review(Long orderId);

    /**
     * 保存配件审核
     * @param fcOrderPartReview
     */
    void savePartsReview(FcOrderPartReview fcOrderPartReview);

    /**
     * 服务商邮寄旧件
     * @param orderPartPost
     * @return
     */
    void updateOldPostFcPart(OrderPartPostListDTO orderPartPost);

    /**
     * 清除厂商单所有配件信息
     */
    void deleteAllParts(Long orderId);

    /**
     * 更新快递状态
     * @param expressageDTO
     */
    void updatePostStatus(ExpressageDTO expressageDTO);

    /**
     * 批量插入配件与物流信息
     * @param partDIOS
     */
    void insertPartListAndPost(List<FactoryNewOrderPartDIO> partDIOS) throws OmsBaseException;
}
